﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.Depo.OverProduction
{
    public partial class LessThan30 : XForm
    {
        public LessThan30()
        {
            InitializeComponent();
        }

        private void LessThan30_Load(object sender, EventArgs e)
        {
            gridView1.Init("Get30MtAlti");
            gridView1.AddDetailGrid(gridView2, "AtelyeId");
            gridView2.AddDetailGrid(gridView3, "AtelyeId,CikisEmriId,CikisTarihi,BrandId,OrderRef");

            gridView1.FormatAsNumber(0, "DonenQty");
            gridView2.FormatAsNumber(0, "DonenQty");
            gridView3.FormatAsNumber(0, "DonenQty");
            gridView3.FormatAsPercentage(1, "DonenYuzde");

            gridView1.AddSummary("DonenQty");
            gridView2.AddSummary("DonenQty");
            gridView3.AddSummary("DonenQty");

            gridView1.MakeReadOnly();
            gridView2.MakeReadOnly();
            gridView3.MakeReadOnly();

            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;
            gridView2.FocusedRowChanged += gridView2_FocusedRowChanged;

            gridView1.BestFitColumns();
            gridView2.BestFitColumns();
            gridView3.BestFitColumns();

            gridView1.MakeRowSelectable();
        }

        void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            gridView3.BestFitColumns();
        }

        void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            gridView2.BestFitColumns();
        }
    }
}
